﻿<!--***********************************************************************************

   Extended WPF Toolkit

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  **********************************************************************************-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
                    xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Mag.Converters"
                    xmlns:coreconv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters">

   <!-- =============================================================================== -->
   <!-- Magnifier                                                                       -->
   <!-- =============================================================================== -->

   <conv:RadiusConverter x:Key="RadiusConverter" />
   <coreconv:BorderThicknessToStrokeThicknessConverter x:Key="BorderThicknessToStrokeThicknessConverter" />

   <ControlTemplate x:Key="CircleTemplate" TargetType="{x:Type local:Magnifier}">
      <Grid>
         <Ellipse Fill="{TemplateBinding Background}" />
         <Ellipse Stroke="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" 
                  StrokeThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BorderThicknessToStrokeThicknessConverter}}">
            <Ellipse.Fill>
               <VisualBrush x:Name="PART_VisualBrush"
                            ViewboxUnits="Absolute"
                            Visual="{Binding Path=Target, RelativeSource={RelativeSource TemplatedParent}}" />
            </Ellipse.Fill>
         </Ellipse>
      </Grid>
   </ControlTemplate>

   <ControlTemplate x:Key="RectangleTemplate" TargetType="{x:Type local:Magnifier}">
      <Grid Background="{TemplateBinding Background}" >
         <Rectangle Stroke="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
                    StrokeThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BorderThicknessToStrokeThicknessConverter}}">
            <Rectangle.Fill>
               <VisualBrush x:Name="PART_VisualBrush"
                            ViewboxUnits="Absolute"
                            Visual="{Binding Path=Target, RelativeSource={RelativeSource TemplatedParent}}" />
            </Rectangle.Fill>
         </Rectangle>
      </Grid>
   </ControlTemplate>

   <Style TargetType="{x:Type local:Magnifier}">
      <Setter Property="IsHitTestVisible" Value="False" />
      <Style.Triggers>
         <Trigger Property="FrameType" Value="Circle">
            <Setter Property="Template" Value="{StaticResource CircleTemplate}" />
         </Trigger>
         <Trigger Property="FrameType" Value="Rectangle">
            <Setter Property="Template" Value="{StaticResource RectangleTemplate}" />
         </Trigger>
      </Style.Triggers>
   </Style>

</ResourceDictionary>
